<style lang="less" scoped>

  .el-row {
    margin-bottom: 20px;
  }

  .el-col {
    border-radius: 4px;
  }

  .f-w25 {
    width: 20% !important;
  }

  .bg-purple-dark {
    background: #ffffff;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .el-form-item {
    margin: 0px 20px 15px 20px;
  }

  .f-bs1 {
    border: 1px solid #dfe6ec;
  }

  .el-collapse {
    border: 0px;
    .el-collapse-item {
      border: 1px solid #dfe6ec;
      margin-bottom: 10px;
      .el-collapse-item__header {
        font-weight: bold;
        .el-collapse-item__header__arrow {
          display: none;
        }
      }
      .el-collapse-item__content {
        padding-bottom: 0px;
      }
      .el-collapse-item__wrap {
        border-bottom: 0px;
      }
    }
  }

  label {
    width: 100px;
  }

  .el-form-item[data-v-7da61f17] {
    margin: 0 0 0 0
  }

  .f-mt10 {
    margin-top: 10px;
  }

  .f-ml20 {
    margin-left: 20px;
  }

  .f-mr20 {
    margin-right: 20px;
  }

  .f-mb10 {
    margin-bottom: 10px;
  }

  .f-tar {
    text-align: right;
  }

  .f-h30 {
    height: 30px;
  }

  .f-c-red {
    color: red;
  }

  .el-radio-group {
    width: 60%;
  }

  .el-radio-invoice {
    margin-right: 30px;
  }

  .f-color {
    color: #25baaf;
  }

  .el-textarea {
    width: 86%;
  }

  .f-mb {
    margin-bottom: 0;
  }

  .f-fr {
    float: right;
  }

  .f-fl {
    float: left;
  }

  .f-lh38 {
    line-height: 38px;
  }

  .el-select {
    width: 100%;
  }

  .f-w233 {
    width: 100%;
  }

  /*.el-form-item__label {*/
  /*width: 150px;*/
  /*}*/

  .el-date-editor.el-input {
    width: 100%;
  }

  li {
    list-style-type: none;
  }

  .color-c8c8c8 {
    color: #c8c8c8;
  }

  .f-mt {
    margin-top: 0;
  }

  .width70 {
    width: 82%;
  }

</style>

<template>
  <section>
    <!--工具条-->

    <!-- 操作 -->
    <el-col :span="24" style="margin-bottom: 10px;margin-top: 10px;">
      <el-button type="primary" @click="handleAdd">新增</el-button>
    </el-col>

    <!--列表-->
    <el-table :data="tableData" highlight-current-row border @sort-change="sortChange"
              @selection-change="selsChange" v-loading="listLoading" style="width: 100%;">
      <el-table-column type="index" label="序号" width="70">
      </el-table-column>
      <el-table-column prop="statusModel.cnDictValname" label="发布状态" width="120" >
      </el-table-column>
      <el-table-column prop="shortFreightNumber" label="短途运价编号" width="170" >
      </el-table-column>
      <el-table-column prop="shortFreightName" label="短途运价名称" width="170" >
      </el-table-column>
      <el-table-column prop="remark" label="描述" >
      </el-table-column>

      <el-table-column prop="modifyDate" width="150" label="最后修改时间" >

        <template slot-scope="scope">
          {{scope.row.modifyDate.toString().substring(0, 10)}}
        </template>
      </el-table-column>

      <el-table-column prop="modifyUserModel.userName" width="150" label="最后修改人" >
      </el-table-column>

      <el-table-column prop="operativeDate" width="150" label="生效时间" >

        <template slot-scope="scope">
          {{scope.row.operativeDate.toString().substring(0, 10)}}
        </template>
      </el-table-column>

      <el-table-column prop="loseEfficacyDate" width="150" label="失效时间" >
        <template slot-scope="scope">
          {{scope.row.loseEfficacyDate.toString().substring(0, 10)}}
        </template>
      </el-table-column>

      <el-table-column label="操作" width="350">

        <template slot-scope="scope">
          <!--待提交-->
          <el-button  type="primary" class="f-mt10 f-mb10 f-ml5"
                     v-if="scope.row.status===112001001"
                     @click="changeStatuss(scope.row.id, 112001002,'提交审核')">提交审核
          </el-button>
          <el-button  type="primary" class="f-ml5" v-if="scope.row.status===112001001"
                     @click="freightShortDetailPage(scope.row)">维护运价
          </el-button>
          <el-button  type="primary" class="f-ml5" v-if="scope.row.status===112001001"
                     @click="getEditBYId(scope.row)">编辑
          </el-button>
          <el-button  type="danger" class="f-mb10 f-ml5" v-if="scope.row.status===112001001"
                     @click="deleteFreightShortById(scope.row.id)">删除
          </el-button>
          <!--待审核-->
          <el-button  type="primary" class="f-ml5" v-if="scope.row.status===112001002"
                     @click="freightShortDetailPage(scope.row)">明细
          </el-button>
          <el-button  type="primary" class="f-ml5" v-if="scope.row.status===112001002"
                     @click="changeStatuss(scope.row.id, 112001003,'发布')">发布
          </el-button>
          <el-button  type="warning" class="f-ml5" v-if="scope.row.status===112001002"
                     @click="changeStatuss(scope.row.id, 112001001,'撤销')">撤销审核
          </el-button>
          <!--已发布 | 已过期 | 已禁用-->
          <el-button  type="primary" class="f-ml5"
                     v-if="scope.row.status===112001003||scope.row.status===112001005||scope.row.status===112001006"
                     @click="freightShortDetailPage(scope.row)">明细
          </el-button>
          <el-button  type="warning" class="f-ml5"
                     v-if="scope.row.status===112001003"
                     @click="changeStatuss(scope.row.id, 112001002,'撤销')">撤销发布
          </el-button>
          <!--已启用-->
          <el-button  type="primary" v-if="scope.row.status===112001004" class="f-ml5"
                     @click="freightShortDetailPage(scope.row)">明细
          </el-button>
          <el-button  type="primary" v-if="scope.row.status===112001004" class="f-ml5"
                     @click="changeStatuss(scope.row.id, 112001006,'禁用')">禁用
          </el-button>
        </template>

      </el-table-column>
    </el-table>

    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination
        :current-page="currentPage"
        :page-size="pageSize"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        layout="total,sizes,prev, pager, next, jumper"
        :total="total" style="float: right">
      </el-pagination>
    </el-col>
    <!--新增短途运价 弹窗 -->
    <el-dialog :title="dialogTitle" size="tiny" :visible.sync="freightShortVisible" :close-on-click-modal="false">
      <el-form :model="freightShort" :rules="rules" label-width="110px" ref="freightShort">
        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="短途运价名称" class="width70" prop="shortFreightName">
              <el-input v-model="freightShort.shortFreightName" placeholder="请输入短途运价名称"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="描述" class="width70" prop="remark">
              <el-input v-model="freightShort.remark" placeholder="请输入描述"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="发布渠道" class="width70" prop="stowageId">
              <el-select v-model="freightShort.stowageId"
                         :remote="true"
                         :remote-method="searchStowage"
                         @change="searchStowage"
                         :filterable="true"
                         placeholder="请选择">
                <el-option v-for="mu in stowage" :label="mu.name"
                           :value="mu.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="生效时间" prop="operativeDate">

              <el-date-picker
                v-model="freightShort.operativeDate"
                type="datetime"
                placeholder="选择日期时间">
              </el-date-picker>

            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="失效时间" prop="loseEfficacyDate">
              <el-date-picker
                v-model="freightShort.loseEfficacyDate"
                type="datetime"
                placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="freightShortVisible = false">取消</el-button>
        <el-button type="primary" @click.native="handleSubmit" :loading="submitLoading">提交</el-button>
      </div>
    </el-dialog>

    <!--打短途运价详情 弹窗 -->
    <el-dialog :title="freightShortBaseTitle" fullscreen :visible.sync="freightShortBaseVisible"
               :close-on-click-modal="false">
      <el-form :model="freightShort" :rules="rules" label-width="80px" ref="freightShort">
        <el-row class="f-mt10 f-mb10">
          <el-col :span="8">
            <el-form-item label="运价编号" class="width70">
              <el-input :disabled="true" v-model="freightShort.shortFreightNumber"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="运价名称" class="width70">
              <el-input :disabled="true" v-model="freightShort.shortFreightName"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="配载中心" class="width70">
              <el-input :disabled="true" v-model="freightShort.stowageName"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="8">
            <el-form-item label="描述" class="width70">
              <el-input :disabled="true" v-model="freightShort.remark"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="生效时间" class="width70">
              <el-input :disabled="true" v-model="freightShort.operativeDate"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="失效时间" class="width70">
              <el-input :disabled="true" v-model="freightShort.loseEfficacyDate">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div>
        <el-row>
          <el-col :span="12">
            <div>
              <!--左边的表格-->
              <div style="width:90%">
                <!-- 操作 -->
                <el-col :span="24" style="margin-bottom: 10px">
                  <el-button type="primary" @click="addFreightShortBase" v-if="freightShort.statusName === '待提交'">新增
                  </el-button>
                </el-col>
                <!--列表-->
                <el-table :data="freithtShortBaseTableData"
                          @current-change="handleFreithtShortBaseCurrentChange"
                          @row-click="currentFreightShortBaseRows"
                          highlight-current-row
                          border @sort-change="sortChange1"
                          @selection-change="selsChange1" v-loading="listLoading1" style="width: 100%;">
                  <el-table-column type="index" label="序号" width="70">
                  </el-table-column>
                  <el-table-column label="区域" >
                    <template slot-scope="scope">
                      {{scope.row.provinceName}} - {{scope.row.cityName}} - {{scope.row.countyName}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="remark" label="提货描述" width="150" >
                  </el-table-column>
                  <el-table-column prop="deliveryRemark" label="送货描述" width="150" >
                  </el-table-column>
                  <el-table-column label="操作" width="150">

                    <template slot-scope="scope">
                      <el-button  v-if="freightShort.statusName === '待提交'" type="primary"
                                 @click="freightShortBaseEdit(scope.$index, scope.row)">编辑
                      </el-button>
                      <el-button type="danger" v-if="freightShort.statusName === '待提交'"
                                 @click="delFreightShortBase(scope.$index, scope.row)">删除
                      </el-button>
                    </template>

                  </el-table-column>
                </el-table>

                <!--工具条-->
                <el-col :span="24" class="toolbar">
                  <el-pagination
                    :current-page="currentPage1"
                    :page-size="pageSize1"
                    @size-change="handleSizeChange1"
                    @current-change="handleCurrentChange1"
                    layout="total,sizes,prev, pager, next, jumper"
                    :total="total1" style="float: right">
                  </el-pagination>
                </el-col>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div style="width:90%">
              <!--右边的表格-->
              <div>
                <el-tabs  type="border-card" v-model="tabsName" style="margin-top: 38px;height: 400px;">
                  <el-tab-pane label="重货" name="112003001">
                    <div v-if="selectFreightShortBase !== null">
                      <el-button style="float: right" type="primary"
                                 :disabled="selectFreightShortBase === null"
                                 @click="handleSaveWeightFreightShortDetails">保存</el-button>
                      <el-radio-group v-model="weightPriceType">
                        <el-radio class="radio" :label=112010001>阶梯单价</el-radio>
                        <el-radio class="radio" :label=112010002>一口单价</el-radio>
                        <el-radio class="radio" :label=112010003>一口总价</el-radio>
                        <el-radio class="radio" :label=112010004>阶梯总价</el-radio>
                      </el-radio-group>
                      <div style="margin-top: 10px;" v-if="weightPriceType===112010003">
                        <el-input v-model.number="weightLumpSum" placeholder="请输入内容">
                          <template slot="prepend">一口总价:</template>
                          <template slot="append">元/票</template>
                        </el-input>
                      </div>
                      <div style="margin-top: 10px;" v-if="weightPriceType===112010002">
                        <el-input v-model.number="weightOneUnitPrice" placeholder="请输入内容">
                          <template slot="prepend">统一单价:</template>
                          <template slot="append">元/吨</template>
                        </el-input>
                      </div>
                      <div v-if="weightPriceType === 112010001" style="margin-top: 10px;">
                        <el-col :span="24" style="margin-bottom: 10px">
                          <el-button type="primary" @click="handleStepPriceAdd(weightStepPrice)">新增</el-button>
                        </el-col>
                        <el-table
                          border
                          :data="weightStepPrice"
                          height="250"
                          style="width: 100%">
                          <el-table-column
                            prop="billingStart"
                            label="计费范围起(吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingStart"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingEnd"
                            label="计费范围止(吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingEnd"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingUnivalence"
                            label="单价(元/吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingUnivalence"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="address"
                            label="操作">
                            <template slot-scope="scope">
                              <el-button

                                type="danger" @click="handleStepPriceDelete(weightStepPrice,scope.$index)">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                      </div>
                      <div v-if="weightPriceType === 112010004" style="margin-top: 10px;">
                        <el-col :span="24" style="margin-bottom: 10px">
                          <el-button type="primary" @click="handleStepPriceAdd(weightStepTotal)">新增</el-button>
                        </el-col>
                        <el-table
                          border
                          :data="weightStepTotal"
                          height="250"
                          style="width: 100%">
                          <el-table-column
                            prop="billingStart"
                            label="计费范围起(吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingStart"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingEnd"
                            label="计费范围止(吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingEnd"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingUnivalence"
                            label="总价(元/吨)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingUnivalence"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="address"
                            label="操作">
                            <template slot-scope="scope">
                              <el-button

                                type="danger" @click="handleStepPriceDelete(weightStepTotal,scope.$index)">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                      </div>
                    </div>
                  </el-tab-pane>
                  <el-tab-pane label="抛货" name="112003002">
                    <div v-if="selectFreightShortBase !== null">
                      <el-radio-group v-model="volumePriceType">
                        <el-radio class="radio" :label=112010001>阶梯单价</el-radio>
                        <el-radio class="radio" :label=112010002>一口单价</el-radio>
                        <el-radio class="radio" :label=112010003>一口总价</el-radio>
                        <el-radio class="radio" :label=112010004>阶梯总价</el-radio>
                      </el-radio-group>
                      <el-button style="float: right" :disabled="selectFreightShortBase === null" type="primary" @click="handleSaveVolumeFreightShortDetails">保存</el-button>
                      <div style="margin-top: 10px;" v-if="volumePriceType===112010003">
                        <el-input v-model.number="volumeLumpSum" placeholder="请输入内容">
                          <template slot="prepend">一口总价:</template>
                          <template slot="append">元/票</template>
                        </el-input>
                      </div>
                      <div style="margin-top: 10px;" v-if="volumePriceType===112010002">
                        <el-input v-model.number="volumeOneUnitPrice" placeholder="请输入内容">
                          <template slot="prepend">统一单价:</template>
                          <template slot="append">元/方</template>
                        </el-input>
                      </div>
                      <div v-if="volumePriceType === 112010001" style="margin-top: 10px;">
                        <el-col :span="24" style="margin-bottom: 10px">
                          <el-button type="primary" @click="handleStepPriceAdd(volumeStepPrice)">新增</el-button>
                        </el-col>
                        <el-table
                          border
                          :data="volumeStepPrice"
                          height="250"
                          style="width: 100%">
                          <el-table-column
                            prop="billingStart"
                            label="计费范围起(方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingStart"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingEnd"
                            label="计费范围止(方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingEnd"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingUnivalence"
                            label="单价(元/方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingUnivalence"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="address"
                            label="操作">
                            <template slot-scope="scope">
                              <el-button

                                type="danger" @click="handleStepPriceDelete(weightStepPrice,scope.$index)">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                      </div>
                      <div v-if="volumePriceType === 112010004" style="margin-top: 10px;">
                        <el-col :span="24" style="margin-bottom: 10px">
                          <el-button type="primary" @click="handleStepPriceAdd(volumeStepTotal)">新增</el-button>
                        </el-col>
                        <el-table
                          border
                          :data="volumeStepTotal"
                          height="250"
                          style="width: 100%">
                          <el-table-column
                            prop="billingStart"
                            label="计费范围起(方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingStart"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingEnd"
                            label="计费范围止(方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingEnd"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="billingUnivalence"
                            label="总价(元/方)"
                            width="180">
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.billingUnivalence"></el-input>
                            </template>
                          </el-table-column>
                          <el-table-column
                            prop="address"
                            label="操作">
                            <template slot-scope="scope">
                              <el-button

                                type="danger" @click="handleStepPriceDelete(volumeStepTotal,scope.$index)">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                      </div>
                    </div>
                  </el-tab-pane>
                </el-tabs>

              </div>
            </div>
          </el-col>
        </el-row>

      </div>
    </el-dialog>
    <!--新增重货基础详情文件-->
    <el-dialog title="新增基础详情文件" :visible.sync="saveBaseDetailDialog" >
      <el-form label-width="100px" ref="freightShortDetails" :model="freightShortDetails">

        <el-form-item label="取价类型" prop="getPriceType">
          <el-radio-group v-model="freightShortDetails.getPriceType"
                          @change="changeData">
            <el-radio class="radio" :label=112010001>阶梯单价</el-radio>
            <el-radio class="radio" :label=112010002>一口单价</el-radio>
            <el-radio class="radio" :label=112010003>一口总价</el-radio>
          </el-radio-group>
          <br/>
          <div v-if="freightShortDetails.getPriceType === 112010001 ">
            <el-form-item>
              <el-button  type="primary" @click="addDomain()" style="float: right">新增</el-button>
            </el-form-item>
            <el-form-item
            >
              <el-table
                :data="tableDataGO"
                style="width: 400%">
                <el-table-column
                  prop="billingStart"
                  label="计费范围起"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="billingEnd"
                  label="计费范围讫"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="billingUnivalence"
                  label="计费单价">
                </el-table-column>
                <el-table-column label="操作" width="150">
                  <template slot-scope="scope">
                    <el-button  type="primary"
                               @click="getEditBillBYId(scope.$index, scope.row)">编辑
                    </el-button>
                    <el-button type="danger"
                               @click.native.prevent="handleBillDel(scope.$index, scope.row, tableDataGO)"
                    >删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </div>
          <div v-if="freightShortDetails.getPriceType === 112010002">
            <el-row>
              <el-col :span="24">
                <div style="margin-left: 220px;margin-top: 50px;">
                  统一单价:
                  <el-input type="number" v-model="fixedPrice" style="width: 20%"
                  ></el-input>
                  元/吨
                </div>
              </el-col>
            </el-row>
          </div>

          <div v-if="freightShortDetails.getPriceType === 112010003">
            <el-row>
              <el-col :span="24">
                <div style="margin-left: 220px;margin-top: 50px;">
                  一口总价:
                  <el-input type="number" v-model="fixedPrice" style="width: 20%"
                  ></el-input>
                  元/票
                </div>
              </el-col>
            </el-row>
          </div>

        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="saveBaseDetailDialog = false">取 消</el-button>
        <el-button type="primary" @click="saveBaseDetails" :loading="submitLoading3">确 定</el-button>
      </div>
    </el-dialog>

    <!--新增泡货基础详情文件-->
    <el-dialog title="新增基础详情文件" :visible.sync="saveBaseThrowDetailDialog" >
      <el-form label-width="100px" ref="freightShortDetails1" :model="freightShortDetails1">

        <el-form-item label="取价类型" prop="getPriceType">
          <el-radio-group v-model="freightShortDetails1.getPriceType"
                          @change="changeData1">
            <el-radio class="radio" :label=112010001>阶梯单价</el-radio>
            <el-radio class="radio" :label=112010002>一口单价</el-radio>
            <el-radio class="radio" :label=112010003>一口总价</el-radio>
          </el-radio-group>
          <br/>
          <div v-if="freightShortDetails1.getPriceType === 112010001 ">
            <el-form-item>
              <el-button  type="primary" @click="addDomain1()" style="float: right">新增</el-button>
            </el-form-item>
            <el-form-item
            >
              <el-table
                :data="tableDataGO1"
                style="width: 400%">
                <el-table-column
                  prop="billingStart"
                  label="计费范围起"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="billingEnd"
                  label="计费范围讫"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="billingUnivalence"
                  label="计费单价">
                </el-table-column>
                <el-table-column label="操作" width="150">
                  <template slot-scope="scope">
                    <el-button  type="primary"
                               @click="getEditBillBYId1(scope.$index, scope.row)">编辑
                    </el-button>
                    <el-button type="danger"
                               @click.native.prevent="handleBillDel1(scope.$index, scope.row, tableDataGO1)"
                    >删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </div>
          <div v-if="freightShortDetails1.getPriceType === 112010002">
            <el-row>
              <el-col :span="24">
                <div style="margin-left: 220px;margin-top: 50px;">
                  统一单价:
                  <el-input type="number" v-model="jettisonFixedPrice" style="width: 20%"
                  ></el-input>
                  元/吨
                </div>
              </el-col>
            </el-row>
          </div>

          <div v-if="freightShortDetails1.getPriceType === 112010003">
            <el-row>
              <el-col :span="24">
                <div style="margin-left: 220px;margin-top: 50px;">
                  一口总价:
                  <el-input type="number" v-model="jettisonFixedPrice" style="width: 20%"
                  ></el-input>
                  元/票
                </div>
              </el-col>
            </el-row>
          </div>

        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="saveBaseThrowDetailDialog = false">取 消</el-button>
        <el-button type="primary" @click="saveThrowBaseDetails" :loading="submitLoading7">确 定</el-button>
      </div>
    </el-dialog>

    <!--新增基础短途运价 弹窗 -->
    <el-dialog :title="freightShortDetailTitle" size="tiny" :visible.sync="freightShortBaseDetailVisible"
               :close-on-click-modal="false">
      <el-form :model="freightShortBase" :rules="rules2" label-width="80px" ref="freightShortBase">
        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="接驳区域" class="width70" prop="myAddress">
              <address-select v-model="freightShortBase.myAddress"
                              placeholder="请选择地址"
                              class="f-w233">

              </address-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="提贷描述" class="width70" prop="remark">
              <el-input v-model="freightShortBase.remark" placeholder="请输入提贷描述"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="送货描述" class="width70" prop="remark">
              <el-input v-model="freightShortBase.deliveryRemark" placeholder="请输入送货描述"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="freightShortBaseDetailVisible = false">取消</el-button>
        <el-button type="primary" @click.native="saveFreightShortBase" :loading="submitLoading2">提交</el-button>
      </div>
    </el-dialog>
    <!--新增 重货阶梯单价 弹窗 -->
    <el-dialog :title="ladderTitle" size="tiny" :visible.sync="ladderVisible"
               :close-on-click-modal="false">
      <el-form :model="domains" :rules="rules4" label-width="100px" ref="domains">
        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费范围起" class="width70" prop="billingStart">
              <el-input type="number" v-model.number="domains.billingStart" placeholder="计费范围起"></el-input>

            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费范围讫" class="width70" prop="billingEnd">
              <el-input type="number" v-model.number="domains.billingEnd" placeholder="计费范围讫"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费单价" class="width70" prop="billingUnivalence">
              <el-input type="number" v-model.number="domains.billingUnivalence" placeholder="计费单价"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="ladderVisible = false">取消</el-button>
        <el-button type="primary" @click.native="saveLadder" :loading="submitLoading5">提交</el-button>
      </div>
    </el-dialog>

    <!--新增 泡货阶梯单价 弹窗 -->
    <el-dialog :title="throwTitle" size="tiny" :visible.sync="throwVisible"
               :close-on-click-modal="false">
      <el-form :model="domains1" :rules="rules5" label-width="100px" ref="domains1">
        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费范围起" class="width70" prop="billingStart">
              <el-input type="number" v-model.number="domains1.billingStart" placeholder="计费范围起"></el-input>

            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费范围讫" class="width70" prop="billingEnd">
              <el-input type="number" v-model.number="domains1.billingEnd" placeholder="计费范围讫"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row class="f-mt10 f-mb10">
          <el-col :span="24">
            <el-form-item label="计费单价" class="width70" prop="billingUnivalence">
              <el-input type="number" v-model.number="domains1.billingUnivalence" placeholder="计费单价"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="throwVisible = false">取消</el-button>
        <el-button type="primary" @click.native="saveThrow" :loading="submitLoading6">提交</el-button>
      </div>
    </el-dialog>
  </section>
</template>

<script>
import {
  saveFreightShortBase,
  getFreightShost,
  searchFreightShort,
  saveFreightShort,
  changeStatus,
  deleteFreightShost,
  searchFreightShortBase,
  deleteFreightShostBase,
  saveFreightShortBaseDetail,
  getFreightShostBase,
  saveFreightBaseDetail
} from '../../api/freight/freightShort';

import {
  searchStowageCore
} from '../../api/system/stowageCore';

import {isEmpty} from '../../lib/util.js';

export default {
  data () {
    return {
      currendDelId: [],
      currendDelId1: [],
      currendHearvy1: '',
      tableDataGO: [],
      tableDataGO1: [],
      saveFreightShortBaseId: '',
      distinctionButton: false,
      distinctionButton1: false,
      currentRowId: '',
      currentRow1: '',
      currentRow: '',
      currentRowId1: '',
      currentIndex: '',
      currentIndex1: '',
      fixedPrice: '', // 一口价
      jettisonFixedPrice: '', // 一口价
      currendHearvy: '', // 当前的取价类型
      tabsName: '112003001',
      heavyTableData: [],
      gentlyTableData: [],
      currendFreightShortBaseId: '', // 当前的基础短途运价ID
      currendFreightShortDetailId: '',
      freightShortBaseTitle: '新增',
      freightShortDetailTitle: '新增',
      freightShortBaseDetailTitle: '新增',
      ladderTitle: '新增阶梯单价',
      throwTitle: '新增阶梯单价',
      condition: {
        name: '',
        number: ''
      },

      dialogTitle: '新增',
      stowage: [],

      sels: [],
      tableData: [],
      total: 0,
      currentPage: 1,
      pageSize: 10,
      sortProp: null,
      sortOrder: 'ascending',
      listLoading: false,

      sels1: [],
      freithtShortBaseTableData: [],
      total1: 0,
      currentPage1: 1,
      pageSize1: 15,
      sortProp1: null,
      sortOrder1: 'ascending',
      listLoading1: false,
      listLoading5: false,
      freightShortVisible: false,
      ladderVisible: false,
      throwVisible: false,
      saveBaseDetailDialog: false,
      saveBaseDetailDialog1: false,
      freightShortBaseVisible: false,
      saveBaseThrowDetailDialog: false,
      freightShortBaseDetailVisible: false,
      freightShortBaseDetailVisible2: false,
      submitLoading: false,
      submitLoading2: false,
      submitLoading3: false,
      submitLoading5: false,
      submitLoading6: false,
      submitLoading7: false,

      // 表单数据
      freightShort: {
        'id': null,
        'shortFreightNumber': null,
        'stowageName': null,
        'shortFreightName': null,
        'operativeDate': null,
        'loseEfficacyDate': null,
        'loseEfficacyDateTemp': null,
        'operativeDateTemp': null,
        'stowageId': null,
        'statusName': null,
        'modityName': null,
        'status': null,
        'collator': null,
        'createUserModel': null,
        'createDate': null,
        'remark': null
      },
      // 基础运价文件的详情表单数据
      freightShortDetails: {
        'id': null,
        'ids': [],
        'tableDataGO': [],
        'freightShortBaseId': null,
        'getfreightShortBaseId': null,
        'billingStart': null,
        'billingEnd': null,
        'getPriceType': 112010001,
        'billingType': null,
        billingUnivalence: '',
        'freightShortBase': null
      },
      // 基础运价文件的详情表单数据
      freightShortDetails1: {
        'id': null,
        'ids': [],
        'tableDataGO': [],
        'freightShortBaseId': null,
        'getfreightShortBaseId': null,
        'billingStart': null,
        'billingEnd': null,
        'getPriceType': 112010001,
        'billingType': null,
        billingUnivalence: '',
        'freightShortBase': null
      },
      priceType: '',
      priceType1: '',
      domains: {
        billingStart: '',
        'id': null,
        billingEnd: '',
        billingUnivalence: ''
      },
      domains1: {
        billingStart: '',
        'id': null,
        billingEnd: '',
        billingUnivalence: ''
      },
      // 表单数据
      freightShortBase: {
        'id': null,
        'freightShortId': null,
        'provinceId': null,
        'cityId': null,
        'countyId': null,
        'deliveryRemark': null,
        'myAddress': [],
        'remark': null
      },

      // 验证规则
      rules: {
        shortFreightName: [
          {required: true, message: '请输入短途运价名称', trigger: 'blur'},
          {min: 2, max: 60, message: '长度在2 到 60 个字符', trigger: 'blur'}
        ],
        remark: [
          {required: true, message: '请输入描述', trigger: 'blur'},
          {min: 2, max: 60, message: '长度在2 到 60 个字符', trigger: 'blur'}
        ],

        stowageId: [
          {required: true, message: '请选择发布渠道', trigger: 'blur'}
        ],
        operativeDate: [
          {type: 'date', required: true, message: '请选择日期', trigger: 'change'}

        ],
        loseEfficacyDate: [
          {type: 'date', required: true, message: '请选择日期', trigger: 'change'}

        ]

      },
      // 验证规则
      rules4: {
        billingStart: [
          {type: 'number', required: true, message: '请输入计费范围起 ', trigger: 'blur'}
        ],
        billingUnivalence: [
          {type: 'number', required: true, message: '请输入计费单价 ', trigger: 'blur'}
        ],
        billingEnd: [
          {type: 'number', required: true, message: '请输入计费范围讫', trigger: 'blur'}
        ]
      },
      rules5: {
        billingStart: [
          {type: 'number', required: true, message: '请输入计费范围起 ', trigger: 'blur'}
        ],
        billingUnivalence: [
          {type: 'number', required: true, message: '请输入计费单价 ', trigger: 'blur'}
        ],
        billingEnd: [
          {type: 'number', required: true, message: '请输入计费范围讫', trigger: 'blur'}
        ]
      },
      // 验证规则
      rules2: {
        myAddress: [
          {required: true, type: 'array', message: '请选择接驳区域', trigger: 'blur'}
        ]
      },
      weightPriceType: null,
      weightOneUnitPrice: null,
      weightLumpSum: null,
      weightStepPrice: [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }],
      weightStepTotal: [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }],
      volumePriceType: null,
      volumeOneUnitPrice: null,
      volumeLumpSum: null,
      volumeStepPrice: [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }],
      volumeStepTotal: [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }],
      selectFreightShortBase: null
    };
  },
  methods: {
    resetWeightFreightShortDetails () {
      this.weightPriceType = null;
      this.weightOneUnitPrice = null;
      this.weightLumpSum = null;
      this.weightStepPrice = [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }];
      this.weightStepTotal = [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }];
    },
    resetVolumeFreightShortDetails () {
      this.volumePriceType = null;
      this.volumeOneUnitPrice = null;
      this.volumeLumpSum = null;
      this.volumeStepPrice = [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }];
      this.volumeStepTotal = [{
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }, {
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      }];
    },
    resetFreightShortDetails () {
      this.resetWeightFreightShortDetails();
      this.resetVolumeFreightShortDetails();
    },
    handleSaveVolumeFreightShortDetails () {
      if (this.volumePriceType === null) {
        this.$message.error('请选择一种取价类型');
        return;
      }
      let param = [];
      if (this.volumePriceType === 112010001) {
        const empty = this.volumeStepPrice.filter(o =>
          o.billingStart === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingEnd === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingUnivalence === null || !this.$ue.regExps.isNum.test(o.billingStart));
        if (empty.length > 0 || this.volumeStepPrice === 0) {
          this.$message.error('请将抛货阶梯价格填写完整且价格只能为数字');
          return;
        }
        this.volumeStepPrice.forEach(o => {
          let item = Object.assign({}, o);
          item.getPriceType = this.volumePriceType;
          item.billingType = 112003002;
          param.push(item);
        });
      }
      if (this.volumePriceType === 112010004) {
        const empty = this.volumeStepTotal.filter(o =>
          o.billingStart === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingEnd === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingUnivalence === null || !this.$ue.regExps.isNum.test(o.billingStart));
        if (empty.length > 0 || this.volumeStepTotal.length === 0) {
          this.$message.error('请将抛货阶梯总价填写完整且价格只能为数字');
          return;
        }
        this.volumeStepTotal.forEach(o => {
          let item = Object.assign({}, o);
          item.getPriceType = this.volumePriceType;
          item.billingType = 112003002;
          param.push(item);
        });
      }
      if (this.volumePriceType === 112010002) {
        if (this.volumeOneUnitPrice === null || !this.$ue.regExps.isNum.test(this.volumeOneUnitPrice)) {
          this.$message.error('抛货一口单价不能为空且只能为数字');
          return;
        }

        param = [{
          getPriceType: this.volumePriceType,
          billingType: 112003002,
          billingUnivalence: this.volumeOneUnitPrice
        }];
      }
      if (this.volumePriceType === 112010003) {
        if (this.volumeLumpSum === null || !this.$ue.regExps.isNum.test(this.volumeLumpSum)) {
          this.$message.error('抛货一口总价不能为空且只能为数字');
          return;
        }
        param = [{
          getPriceType: this.volumePriceType,
          billingType: 112003002,
          billingUnivalence: this.volumeLumpSum
        }];
      }
      saveFreightBaseDetail(this.selectFreightShortBase.id, param).then(res => {
        if (res.data.successFlg) {
          this.$message('保存成功');
          this.loadSearchFreightShortBase(this.currendFreightShortBaseId);
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    },
    handleSaveWeightFreightShortDetails () {
      if (this.weightPriceType === null) {
        this.$message.error('请选择一种重货取价类型');
        return;
      }
      let param = [];
      if (this.weightPriceType === 112010001) {
        const empty = this.weightStepPrice.filter(o =>
          o.billingStart === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingEnd === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingUnivalence === null || !this.$ue.regExps.isNum.test(o.billingStart));
        if (empty.length > 0 || this.weightStepPrice.length === 0) {
          this.$message.error('请将重货阶梯单价填写完整且价格只能为数字');
          return;
        }
        this.weightStepPrice.forEach(o => {
          let item = Object.assign({}, o);
          item.getPriceType = 112010001;
          item.billingType = 112003001;
          param.push(item);
        });
      }
      if (this.weightPriceType === 112010004) {
        const empty = this.weightStepTotal.filter(o =>
          o.billingStart === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingEnd === null || !this.$ue.regExps.isNum.test(o.billingStart) ||
            o.billingUnivalence === null || !this.$ue.regExps.isNum.test(o.billingStart));
        if (empty.length > 0 || this.weightStepTotal.length === 0) {
          this.$message.error('请将重货阶梯总价填写完整且价格只能为数字');
          return;
        }
        this.weightStepTotal.forEach(o => {
          let item = Object.assign({}, o);
          item.getPriceType = 112010004;
          item.billingType = 112003001;
          param.push(item);
        });
      }
      if (this.weightPriceType === 112010002) {
        if (this.weightOneUnitPrice === null || !this.$ue.regExps.isNum.test(this.weightOneUnitPrice)) {
          this.$message.error('重货一口单价不能为空且只能为数字');
          return;
        }
        param = [{
          getPriceType: 112010002,
          billingType: 112003001,
          billingUnivalence: this.weightOneUnitPrice
        }];
      }
      if (this.weightPriceType === 112010003) {
        if (this.weightLumpSum === null || !this.$ue.regExps.isNum.test(this.weightLumpSum)) {
          this.$message.error('一口总价不能为空且只能为数字');
          return;
        }
        param = [{
          getPriceType: 112010003,
          billingType: 112003001,
          billingUnivalence: this.weightLumpSum
        }];
      }
      saveFreightBaseDetail(this.selectFreightShortBase.id, param).then(res => {
        if (res.data.successFlg) {
          this.$message('保存成功');
          this.loadSearchFreightShortBase(this.currendFreightShortBaseId);
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    },
    handleStepPriceAdd (table) {
      table.push({
        billingStart: null,
        billingEnd: null,
        billingUnivalence: null
      });
    },
    handleStepPriceDelete (table, index) {
      table.splice(index, 1);
    },
    // 重抛货标签切换方法
    switcherData () {
      if (this.saveFreightShortBaseId === '') {
        return this.$message.error('请先选择接驳区域');
      }
      this.currentFreightShortBaseRowss();
    },
    // 删除重货阶梯单价
    handleBillDel (index, row, rows) {
      this.currendDelId.push(row.id);
      rows.splice(index, 1);
    },
    // 删除泡货阶梯单价
    handleBillDel1 (index, row, rows) {
      this.currendDelId1.push(row.id);
      rows.splice(index, 1);
    },
    // 编辑重货阶梯单价
    getEditBillBYId (index, row) {
      console.log(row);
      this.domains.billingStart = '';
      this.domains.id = '';
      this.domains.billingEnd = '';
      this.domains.billingUnivalence = '';
      this.currentRowId = row.id;
      this.currentRow = row;
      this.currentIndex = index;
      this.ladderTitle = '修改';
      this.domains = Object.assign({
        'billingStart': null,
        'id': null,
        'billingEnd': null,
        'billingUnivalence': null
      }, row);
      this.ladderVisible = true;
    },
    // 编辑泡货阶梯单价
    getEditBillBYId1 (index, row) {
      this.domains1.billingStart = '';
      this.domains1.id = '';
      this.domains1.billingEnd = '';
      this.domains1.billingUnivalence = '';
      this.currentRowId1 = row.id;
      this.currentRow1 = row;
      this.currentIndex1 = index;
      this.throwTitle = '修改';
      this.domains1 = Object.assign({
        'billingStart': null,
        'id': null,
        'billingEnd': null,
        'billingUnivalence': null
      }, row);
      this.throwVisible = true;
    },
    // 重货保存阶梯单价
    saveLadder () {
      this.$refs['domains'].validate((valid) => {
        if (valid) {
          let routeFreightNew = null;
          if (this.tableDataGO.length > 0) {
            for (let x = 0; x < this.tableDataGO.length; x++) {
              if (this.currentRowId === this.tableDataGO[x].id) {
                this.tableDataGO.splice(this.currentIndex, 1);
                routeFreightNew = Object.assign({
                  'billingStart': null,
                  'id': null,
                  'billingEnd': null,
                  'billingUnivalence': null
                }, this.domains);
              } else {
                routeFreightNew = Object.assign({
                  'billingStart': null,
                  'id': null,
                  'billingEnd': null,
                  'billingUnivalence': null
                }, this.domains);
              }
            }
          } else {
            routeFreightNew = Object.assign({
              'billingStart': null,
              'id': null,
              'billingEnd': null,
              'billingUnivalence': null
            }, this.domains);
          }
          this.tableDataGO.push(routeFreightNew);
          this.freightShortDetails.getPriceType = 112010001;
          this.ladderVisible = false;
        } else {
          return false;
        }
      });
    },

    // 泡货保存阶梯单价
    saveThrow () {
      this.$refs['domains1'].validate((valid) => {
        if (valid) {
          let routeFreightNew = null;
          if (this.tableDataGO1.length > 0) {
            for (let x = 0; x < this.tableDataGO1.length; x++) {
              if (this.currentRowId1 === this.tableDataGO1[x].id) {
                this.tableDataGO1.splice(this.currentIndex1, 1);
                routeFreightNew = Object.assign({
                  'billingStart': null,
                  'id': null,
                  'billingEnd': null,
                  'billingUnivalence': null
                }, this.domains1);
              } else {
                routeFreightNew = Object.assign({
                  'billingStart': null,
                  'id': null,
                  'billingEnd': null,
                  'billingUnivalence': null
                }, this.domains1);
              }
            }
          } else {
            routeFreightNew = Object.assign({
              'billingStart': null,
              'id': null,
              'billingEnd': null,
              'billingUnivalence': null
            }, this.domains1);
          }
          this.tableDataGO1.push(routeFreightNew);
          this.freightShortDetails1.getPriceType = 112010001;
          this.throwVisible = false;
        } else {
          return false;
        }
      });
    },
    // BASE重货详情的编辑
    getEditByFreightShortBaseId (val) {
      this.freightShortDetails.getfreightShortBaseId = this.saveFreightShortBaseId;
      this.freightShortDetails.billingType = val;
      this.saveBaseDetailDialog = true;
    },
    getEditByFreightShortBaseId1 (val) {
      this.freightShortDetails1.getfreightShortBaseId = this.saveFreightShortBaseId;
      this.freightShortDetails1.billingType = val;
      this.saveBaseThrowDetailDialog = true;
    },
    // 重货的取价类开进变更
    changeData (val) {
      this.currendDelId = [];
      if (val === this.priceType || isEmpty(this.freightShortDetails.id)) {
        return;
      }
      this.currendDelId.push(this.freightShortDetails.id);
    },
    // 泡货的取价类型变更
    changeData1 (val) {
      this.currendDelId1 = [];
      if (val === this.priceType1 || isEmpty(this.freightShortDetails1.id)) {
        return;
      }
      this.currendDelId1.push(this.freightShortDetails1.id);
    },
    // 新增重货BASE详情
    saveBaseDetails () {
      this.$refs['freightShortDetails'].validate((valid) => {
        if (valid) {
          if (this.freightShortDetails.getPriceType === 112010001 && this.tableDataGO.length === 0) {
            return this.$message.error('请填写阶梯单价数据');
          }
          if (this.freightShortDetails.getPriceType === 112010001 && this.tableDataGO != null && this.tableDataGO.length > 0) {
            this.freightShortDetails.tableDataGO = this.tableDataGO;
            this.fixedPrice = '';
          }
          if (this.freightShortDetails.getPriceType === 112010002 || this.freightShortDetails.getPriceType === 112010003) {
            this.tableDataGO.forEach(dt => {
              this.currendDelId.push(dt.id);
            });
            this.tableDataGO = [];
            this.freightShortDetails.tableDataGO = [];
            this.freightShortDetails.billingUnivalence = this.fixedPrice;
          }
          this.freightShortDetails.ids = this.currendDelId;
          this.submitLoading3 = true;
          saveFreightShortBaseDetail(this.freightShortDetails).then((res) => {
            this.submitLoading3 = false;
            if (res.data.successFlg) {
              this.currentFreightShortBaseRowss();
              this.saveBaseDetailDialog = false;
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },

    // 新增泡货BASE详情
    saveThrowBaseDetails () {
      this.$refs['freightShortDetails1'].validate((valid) => {
        if (valid) {
          if (this.freightShortDetails1.getPriceType === 112010001 && this.tableDataGO1.length === 0) {
            return this.$message.error('请填写阶梯单价数据');
          }
          if (this.freightShortDetails1.getPriceType === 112010001 && this.tableDataGO1 != null && this.tableDataGO1.length > 0) {
            this.freightShortDetails1.tableDataGO = this.tableDataGO1;
            this.jettisonFixedPrice = '';
          }
          if (this.freightShortDetails1.getPriceType === 112010002 || this.freightShortDetails1.getPriceType === 112010003) {
            this.tableDataGO1.forEach(dt => {
              this.currendDelId1.push(dt.id);
            });
            this.tableDataGO1 = [];
            this.freightShortDetails1.tableDataGO = [];
            this.freightShortDetails1.billingUnivalence = this.jettisonFixedPrice;
          }
          this.freightShortDetails1.ids = this.currendDelId1;
          this.submitLoading7 = true;
          saveFreightShortBaseDetail(this.freightShortDetails1).then((res) => {
            this.submitLoading7 = false;
            if (res.data.successFlg) {
              this.currentFreightShortBaseRowss();
              this.saveBaseThrowDetailDialog = false;
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },

    // 删除BASE详情里的新增行
    removeDomain (item) {
      var index = this.domains.indexOf(item);
      if (index !== -1) {
        this.domains.splice(index, 1);
      }
    },
    // 新增重货BASE详情里的新增行
    addDomain () {
      this.domains.billingStart = '';
      this.domains.id = '';
      this.domains.billingEnd = '';
      this.domains.billingUnivalence = '';
      this.currentRowId = 123456789;
      this.ladderVisible = true;
    },

    // 新增泡货BASE详情里的新增行
    addDomain1 () {
      this.domains1.billingStart = '';
      this.domains1.id = '';
      this.domains1.billingEnd = '';
      this.domains1.billingUnivalence = '';
      this.currentRowId = 123456789;
      this.throwVisible = true;
    },
    // 重货 新增 弹窗口
    saveDetailDialogFun (val) {
      alert(this.saveFreightShortBaseId);
      if (this.saveFreightShortBaseId === '') {
        return this.$message.error('请先选择接驳区域');
      }
      this.tableDataGO = [];
      this.freightShortDetails.billingType = val;
      this.freightShortDetails.billingUnivalence = '';
      this.freightShortDetails.getPriceType = 112010001;
      this.saveBaseDetailDialog = true;
    },
    // 泡货 新增 弹窗口
    saveDetailDialogFun1 (val) {
      if (this.saveFreightShortBaseId === '') {
        return this.$message.error('请先选择接驳区域');
      }
      this.tableDataGO1 = [];
      this.freightShortDetails1.billingType = val;
      this.freightShortDetails1.billingUnivalence = '';
      this.freightShortDetails1.getPriceType = 112010001;
      this.saveBaseThrowDetailDialog = true;
    },
    handleFreithtShortBaseCurrentChange (val) {
      this.selectFreightShortBase = val;
      if (val) {
        getFreightShostBase(val.id).then((res) => {
          if (res.data.successFlg) {
            let weightItems = res.data.obj.freightShortDetailsList.filter(o => o.billingType === 112003001);
            if (weightItems.length) {
              this.weightPriceType = weightItems[0].getPriceType;
              if (this.weightPriceType === 112010001) {
                this.weightStepPrice = weightItems.map(o => {
                  return {
                    billingStart: o.billingStart,
                    billingEnd: o.billingEnd,
                    billingUnivalence: o.billingUnivalence
                  };
                });
              }
              if (this.weightPriceType === 112010004) {
                this.weightStepTotal = weightItems.map(o => {
                  return {
                    billingStart: o.billingStart,
                    billingEnd: o.billingEnd,
                    billingUnivalence: o.billingUnivalence
                  };
                });
              }
              if (this.weightPriceType === 112010002) {
                this.weightOneUnitPrice = weightItems[0].billingUnivalence;
              }
              if (this.weightPriceType === 112010003) {
                this.weightLumpSum = weightItems[0].billingUnivalence;
              }
            } else {
              this.resetWeightFreightShortDetails();
            }

            let volumeItems = res.data.obj.freightShortDetailsList.filter(o => o.billingType === 112003002);
            if (volumeItems.length) {
              this.volumePriceType = volumeItems[0].getPriceType;
              if (this.volumePriceType === 112010001) {
                this.volumeStepPrice = volumeItems.map(o => {
                  return {
                    billingStart: o.billingStart,
                    billingEnd: o.billingEnd,
                    billingUnivalence: o.billingUnivalence
                  };
                });
              }
              if (this.volumePriceType === 112010004) {
                this.volumeStepTotal = volumeItems.map(o => {
                  return {
                    billingStart: o.billingStart,
                    billingEnd: o.billingEnd,
                    billingUnivalence: o.billingUnivalence
                  };
                });
              }
              if (this.volumePriceType === 112010002) {
                this.volumeOneUnitPrice = volumeItems[0].billingUnivalence;
              }
              if (this.volumePriceType === 112010003) {
                this.volumeLumpSum = volumeItems[0].billingUnivalence;
              }
            } else {
              this.resetVolumeFreightShortDetails();
            }
          }
        });
      } else {
        this.resetFreightShortDetails();
      }
    },
    // 短驳base表被单击选中时
    currentFreightShortBaseRows (val) {
      this.distinctionButton = false;
      this.distinctionButton1 = false;
      this.heavyTableData = [];
      this.tableDataGO = [];
      this.tableDataGO1 = [];
      this.fixedPrice = '';
      this.currendHearvy = '';
      this.currendHearvy1 = '';
      this.jettisonFixedPrice = '';
      this.gentlyTableData = [];
      this.freightShortDetails.getfreightShortBaseId = val.id;
      this.freightShortDetails1.getfreightShortBaseId = val.id;
      this.saveFreightShortBaseId = val.id;
    },
    currentFreightShortBaseRowss () {
      this.heavyTableData = [];
      this.gentlyTableData = [];
      this.distinctionButton = false;
      this.distinctionButton1 = false;
      this.tableDataGO = [];
      this.tableDataGO1 = [];
      this.fixedPrice = '';
      this.currendHearvy = '';
      this.currendHearvy1 = '';
      this.jettisonFixedPrice = '';
      this.freightShortDetails.billingUnivalence = '';
      this.freightShortDetails1.billingUnivalence = '';
      this.resetFreishtShortBaseTwoForm1();
      this.resetFreishtShortBaseTwoForm();
      getFreightShostBase(this.saveFreightShortBaseId).then((res) => {
        if (res.data.successFlg && res.data.obj.freightShortDetailsList.length > 0) {
          let detailList = res.data.obj.freightShortDetailsList;
          for (let detail in detailList) {
            if (detailList[detail].billingType === 112003001) {
              this.freightShortDetails.getPriceType = detailList[detail].getPriceType;
              if (detailList[detail].getPriceType === 112010001) {
                this.currendHearvy = 112010001;
                this.distinctionButton = true;
                this.fixedPrice = '';
                this.heavyTableData.push(detailList[detail]);
                this.tableDataGO.push(detailList[detail]);
                this.freightShortDetails.tableDataGO.push(detailList[detail]);
              } else if (detailList[detail].getPriceType === 112010002) {
                this.currendHearvy = 112010002;
                this.distinctionButton = true;
                this.fixedPrice = detailList[detail].billingUnivalence;
              } else if (detailList[detail].getPriceType === 112010003) {
                this.currendHearvy = 112010003;
                this.distinctionButton = true;
                this.fixedPrice = detailList[detail].billingUnivalence;
              } else {
                this.distinctionButton = false;
              }
            } else {
              if (detailList[detail].billingType === 112003002) {
                this.freightShortDetails1.getPriceType = detailList[detail].getPriceType;
                if (detailList[detail].getPriceType === 112010001) {
                  this.currendHearvy1 = 112010001;
                  this.distinctionButton1 = true;
                  this.gentlyTableData.push(detailList[detail]);
                  this.tableDataGO1.push(detailList[detail]);
                  this.freightShortDetails.tableDataGO.push(detailList[detail]);
                } else if (detailList[detail].getPriceType === 112010002) {
                  this.currendHearvy1 = 112010002;
                  this.distinctionButton1 = true;
                  this.jettisonFixedPrice = detailList[detail].billingUnivalence;
                } else if (detailList[detail].getPriceType === 112010003) {
                  this.distinctionButton1 = true;
                  this.currendHearvy1 = 112010003;
                  this.jettisonFixedPrice = '';
                  this.jettisonFixedPrice = detailList[detail].billingUnivalence;
                } else {
                  this.distinctionButton1 = false;
                }
              }
            }
          }
        } else {
          this.distinctionButton = false;
          this.distinctionButton1 = false;
        }
      });
    },
    //        根据ID删除基础运价文件
    delFreightShortBase (index, row) {
      this.$confirm('确认删除该基础运价文件吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.listLoading = true;
        deleteFreightShostBase(row.id).then((res) => {
          this.listLoading = false;
          this.$message({
            message: '删除成功！',
            type: 'success'
          });
          this.getFreightShortBaseTableData();
        });
      }).catch(() => {
      });
    },
    //        保存基础运价文件
    saveFreightShortBase () {
      this.freightShortBase.freightShortId = this.currendFreightShortBaseId;
      this.$refs['freightShortBase'].validate((valid) => {
        if (valid) {
          if (this.freightShortBase.myAddress.length === 0) {
            return this.$message.error('请至少选择省份');
          }
          if (this.freightShortBase.myAddress.length === 1) {
            this.freightShortBase.provinceId = this.freightShortBase.myAddress[0];
          }
          if (this.freightShortBase.myAddress.length === 2) {
            this.freightShortBase.provinceId = this.freightShortBase.myAddress[0];
            this.freightShortBase.cityId = this.freightShortBase.myAddress[1];
          }
          if (this.freightShortBase.myAddress.length === 3) {
            this.freightShortBase.provinceId = this.freightShortBase.myAddress[0];
            this.freightShortBase.cityId = this.freightShortBase.myAddress[1];
            this.freightShortBase.countyId = this.freightShortBase.myAddress[2];
          }
          this.submitLoading2 = true;
          saveFreightShortBase(this.freightShortBase).then((res) => {
            this.submitLoading2 = false;
            if (res.data.successFlg === true) {
              this.freightShortBaseDetailVisible = false;
              searchFreightShortBase({
                filters: 'EQ_freightShort.id=' + this.currendFreightShortBaseId,
                sorts: '',
                page: this.currentPage1,
                size: this.pageSize1
              }).then((res) => {
                if (res.data.successFlg === true) {
                  this.freithtShortBaseTableData = res.data.detailModelList;
                  this.$message.success('保存/修改成功！');
                  this.currentPage1 = res.data.currPage;
                  this.total1 = res.data.totalCount;
                  this.pageSize1 = res.data.pageSize;
                  this.listLoading1 = false;
                } else {
                  this.$message.error(res.data.errorMsg);
                }
              });
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },
    loadSearchFreightShortBase (id) {
      searchFreightShortBase({
        filters: 'EQ_freightShort.id=' + id,
        sorts: '',
        page: this.currentPage1,
        size: this.pageSize1
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.freithtShortBaseTableData = res.data.detailModelList;
          this.currentPage1 = res.data.currPage;
          this.total1 = res.data.totalCount;
          this.pageSize1 = res.data.pageSize;
          this.listLoading1 = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    },
    //      明细
    freightDetailPage (row) {
      getFreightShost(row.id).then((res) => {
        this.freightShort = res.data.obj;
        this.currendFreightShortBaseId = row.id;
        this.loadSearchFreightShortBase(row.id);
        this.freightShortBaseVisible = true;
      });
    },
    // 打开维护运价
    freightShortDetailPage (row) {
      getFreightShost(row.id).then((res) => {
        this.freightShort = res.data.obj;
        this.currendFreightShortBaseId = row.id;
      });
      searchFreightShortBase({
        filters: 'EQ_freightShort.id=' + row.id,
        sorts: '',
        page: this.currentPage1,
        size: this.pageSize1
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.freithtShortBaseTableData = res.data.detailModelList;
          this.currentPage1 = res.data.currPage;
          this.total1 = res.data.totalCount;
          this.pageSize1 = res.data.pageSize;
          this.listLoading1 = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
      this.freightShortBaseVisible = true;
    },

    // 很据ID删除短途运价
    deleteFreightShortById (row) {
      this.$confirm('确认删除该用户吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.listLoading = true;
        deleteFreightShost(row).then((res) => {
          this.listLoading = false;
          this.$message({
            message: '删除成功！',
            type: 'success'
          });
          this.getTableData();
        });
      }).catch(() => {
      });
    },

    // 打开运价文件编辑界面
    getEditBYId (row) {
      this.resetForm();
      this.freightShort = Object.assign({}, row);
      this.dialogTitle = '修改';
      this.freightShortVisible = true;
    },
    // 打开基础运价文件编辑界面
    freightShortBaseEdit (index, row) {
      this.resetFreishtShortBaseForm();
      this.freightShortBase = Object.assign({
        'id': null,
        'freightShortId': null,
        'provinceId': null,
        'cityId': null,
        'countyId': null,
        'myAddress': [],
        'remark': null
      }, row);
      this.freightShortBase.myAddress = [row.provinceId, row.cityId, row.countyId];
      this.freightShortDetailTitle = '修改';
      this.freightShortBaseDetailVisible = true;
    },
    /**
       * 根据短途运价文件id,更改短途运价文件状态
       */
    changeStatuss (id, status, msg) {
      this.$confirm('更改短途运价文件状态, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        changeStatus(id, status).then((res) => {
          if (res.data.successFlg) {
            this.$message.success(msg + '成功');
            this.getTableData();
          }
        }).catch(function (error) {
          this.$message.error(msg + '失败');
          console.log(error);
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消' + msg
        });
      });
    },

    // 新增短途运价数据提交
    handleSubmit () {
      // 表单验证
      if (this.freightShort.operativeDate > this.freightShort.loseEfficacyDate) {
        return this.$message.error('生效时间不能超过失效时间');
      }
      if (!isEmpty(this.freightShort.operativeDate)) {
        this.freightShort.operativeDate = new Date(this.freightShort.operativeDate);
      }
      if (!isEmpty(this.freightShort.loseEfficacyDate)) {
        this.freightShort.loseEfficacyDate = new Date(this.freightShort.loseEfficacyDate);
      }
      this.freightShort.operativeDateTemp = this.freightShort.operativeDate.Format('yyyy-MM-dd hh:mm:ss');
      this.freightShort.loseEfficacyDateTemp = this.freightShort.loseEfficacyDate.Format('yyyy-MM-dd hh:mm:ss');
      this.$refs['freightShort'].validate((valid) => {
        if (valid) {
          this.submitLoading = true;
          saveFreightShort(this.freightShort).then((res) => {
            this.submitLoading = false;
            if (res.data.successFlg === true) {
              this.freightShortVisible = false;
              this.$message.success('保存/修改成功！');
              this.getTableData();
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },

    // 搜索配载节点
    searchStowage (val) {
      let filters = isEmpty(val) ? '' : 'LIKE_name=' + val;
      searchStowageCore({
        filters: filters,
        sorts: '',
        size: '15',
        page: '1'
      }).then((res) => {
        this.stowage = res.data.detailModelList;
      });
    },
    // 弹出添加窗体
    handleAdd () {
      this.dialogTitle = '新增';
      this.resetForm();
      this.freightShortVisible = true;
    },
    //      打开基础运价的窗口
    addFreightShortBase () {
      this.resetFreishtShortBaseForm();
      this.freightShortBase.myAddress = [];
      this.freightShortBase.remark = '';
      this.freightShortDetailTitle = '新增';
      this.freightShortBaseDetailVisible = true;
    },
    // 重置表单
    resetForm () {
      if (this.$refs.freightShort) {
        this.$refs.freightShort.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.freightShort) {
        if (this.freightShort[p] instanceof Array) {
          this.freightShort[p] = [];
        } else {
          this.freightShort[p] = null;
        }
      }
    },
    // 重置基础运价表单
    resetFreishtShortBaseForm () {
      if (this.$refs.freightShortBase) {
        this.$refs.freightShortBase.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.freightShortBase) {
        if (this.freightShortBase[p] instanceof Array) {
          this.freightShortBase[p] = [];
        } else {
          this.freightShortBase[p] = null;
        }
      }
    },
    // 重置基础运价表单
    resetFreishtShortBaseTwoForm () {
      if (this.$refs.freightShortDetails) {
        this.$refs.freightShortDetails.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.freightShortDetails) {
        if (this.freightShortDetails[p] instanceof Array) {
          this.freightShortDetails[p] = [];
        } else {
          this.freightShortDetails[p] = null;
        }
      }
    },
    // 重置基础运价表单
    resetFreishtShortBaseTwoForm1 () {
      if (this.$refs.freightShortDetails1) {
        this.$refs.freightShortDetails1.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.freightShortDetails1) {
        if (this.freightShortDetails1[p] instanceof Array) {
          this.freightShortDetails1[p] = [];
        } else {
          this.freightShortDetails1[p] = null;
        }
      }
    },
    // 多选操作
    selsChange (sels) {
      this.sels = sels;
    },
    // 排序操作
    sortChange (o) {
      this.sortProp = o.prop;
      this.sortOrder = o.order;
      this.getTableData();
    },
    // 每页几条操作
    handleSizeChange (val) {
      this.pageSize = val;
      this.getTableData();
    },
    // 第几页操作
    handleCurrentChange (val) {
      this.currentPage = val;
      this.getTableData();
    },
    // 短途运价详情 start
    // 多选操作
    selsChange1 (sels) {
      this.sels1 = sels;
    },
    // 排序操作
    sortChange1 (o) {
      this.sortProp1 = o.prop;
      this.sortOrder1 = o.order;
      this.getFreightShortBaseTableData();
    },
    // 每页几条操作
    handleSizeChange1 (val) {
      this.pageSize1 = val;
      this.getFreightShortBaseTableData();
    },
    // 第几页操作
    handleCurrentChange1 (val) {
      this.currentPage1 = val;
      this.getFreightShortBaseTableData();
    },
    // 短途运价详情 end

    // 获取基础运价文件表格数据
    getFreightShortBaseTableData () {
      searchFreightShortBase({
        filters: 'EQ_freightShort.id=' + this.currendFreightShortBaseId,
        sorts: '',
        page: this.currentPage1,
        size: this.pageSize1
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.freithtShortBaseTableData = res.data.detailModelList;
          this.currentPage1 = res.data.currPage;
          this.total1 = res.data.totalCount;
          this.pageSize1 = res.data.pageSize;
          this.listLoading1 = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    },
    // 获取表格数据
    getTableData () {
      this.listLoading = true;
      searchFreightShort({
        filters: '',
        sorts: '',
        page: this.currentPage,
        size: this.pageSize
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.tableData = res.data.detailModelList;
          this.currentPage = res.data.currPage;
          this.total = res.data.totalCount;
          this.pageSize = res.data.pageSize;
          this.listLoading = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    }
  },
  // 初始化数据
  mounted () {
    this.getTableData();
    this.searchStowage();
    this.$store.commit('initDict');
  }
};
</script>
